package member.memberjoin;
import java.io.*;
import java.sql.*;
import java.util.*;

import javax.servlet.*;
import javax.servlet.http.*;

import db.member.*;
public class MemberJoin extends HttpServlet{
	public void doPost(HttpServletRequest request,
			  HttpServletResponse response){
			  try {
				  requestPro(request,response);
			   } catch (Exception e) {
			    e.printStackTrace();
			   } 
			 }
	 public void doGet(HttpServletRequest request,
	  HttpServletResponse response){
	  try {requestPro(request,response);
	   } catch (Exception e) {
	    e.printStackTrace();
	   }
	 }
	 
	 public void requestPro(HttpServletRequest request,
			  HttpServletResponse response) throws Exception{
		 System.out.println("member.memberjoin:MemberJoin");
			  MemberDAO dao=new MemberDAO();
			  MemberBean bean=new MemberBean();
			  boolean a=false;
			  request.setCharacterEncoding("euc-kr");
			  String id=request.getParameter("id");
			  String pwd=request.getParameter("pwd");
			  String name=request.getParameter("name");
			  String mobile=request.getParameter("mobile");
			  String zipcode1=request.getParameter("zipcode1");
			  String zipcode2=request.getParameter("zipcode2");
			  String address1=request.getParameter("address1");
			  String address2=request.getParameter("address2");
			  String jumin1=request.getParameter("jumin1");
			  String jumin2=request.getParameter("jumin2");
			  String email1=request.getParameter("email1");
			  String email2=request.getParameter("email2");
			  String manager=request.getParameter("manager");
		
			  String zipcode=zipcode1+"-"+zipcode2;
			  String email=email1+"@"+email2;
			  bean.setId(id);
			  bean.setPwd(pwd);
			  bean.setName(name);
			  bean.setMobile(mobile);
			  bean.setZipcode(zipcode);
			  bean.setAddress1(address1);
			  bean.setAddress2(address2);
			  bean.setJumin1(jumin1);
			  bean.setJumin2(jumin2);
			  bean.setEmail(email);
			  bean.setManager(manager);
		
			  a=dao.empJoin(bean);
			  
			  if(a==true){
			  response.setContentType("text/html; charset=euc-kr");
				PrintWriter out = response.getWriter();
				out.close();
			  }else{
				  response.setContentType("text/html; charset=euc-kr");
					PrintWriter out = response.getWriter();
					out.close(); 
			  }
		}
}
